home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbfaqr01.zip
/
A86TEST.DOC
< prev
next >
Wrap
Text File
|
1992-08-11
|
4KB
|
85 lines
data segment para public 'data'
first_variable dw ? ;these are two word lenght variables
which
second_variable dw ? ;is just the right len for an integer
code segment para public 'code
addit:mov ax,0100 ;mov hex 100 into ax
mov first_variable,ax ;mov hex 100 from ax into first_variable
mov ax,0150 ;mov hex 150 into ax
mov second_variable,ax ;mov hex 150 from ax into second_variable
;we now want to increment the value of
;first_varible by the amount found in
;second variable. We can do this one of
;two ways:
mov dx,0
mov ax,first_variable
add ax,second_variable ;if we have an overflow condition we want
;to store the overflow in dx:
if c add dx,1 ;this is unique to a86! it allows a one
;instruction jump
;we have now added the value of
second_variable
;to the value of first_variable and the
;result is in ax, so:
mov first_variable,ax ;this transfers the total into
first_variable
mov second_variable,dx ;this moves the overflow into
second_variable
retf ;far return to calling proceedure. If any
;parameters passed, remember to clean up
;the stack: retf 2*number_of_parms
;The second way would be as such:
incrementit:mov dx,0 ;sets dx to zero
mov ax,first_variable ;moves contents of first_variable into ax
mov cx,second_variable ;moves contents of second_variable into a
;counter register,cx
L1:inc ax ;L1 is a local lable
if c add dx,1 ;if operator is unique to A86 to perform
;a one instruction jump
loop L1 ;each time a loop is performed, cx is dec
;by one and will loop until cx=0
mov first_variable,ax ;as above, we store contents of ax into
;first_varaible
mov second_varaible,dx ;and the contents of dx into second_variable
retf ;remember to clean up the stack!
The only times you need asciiz strings are when you are dealing with
file names, such as opening,closing, reading or writing to a file
using file handles. If you are printing a string to the screen, say
using int 021 function 09, then you need your string to end in a
dollar sign like this:
sample_string db 'this string is to be printed$'
Int 021 function 09 will print to the screen:
this string is to be printed
the "$" will not be printed but is used by int 021 function 09 as the
string terminator.
Int 010 function 0a will let you print a string to the screen starting
at the current cursor position. You must tell this function the
length of the string in cx. Other then that, this string needs no
termination code, such a chr$(0) or "$". Note this is a bios call and
will work on must compatables, but is not guaranteed to work on all.
It is fairly fast and is easy to work with.
Things to watch for is ES and DS. The extra segment and data segment.
Most of my bugs that have given me headaches are these two
registers!!!! Moving strings from one location to another uses DS:SI
for the sourse location and ES:DI for the destination location.
Almost all string manipulation uses one or both of these combinations.
Well have fun with A86. To me its greatest use is to make small, very
fast subs for making librarys for use with QBX and QB. It is fun to
work with, but can be very, very frustrating at times especially when
it does just what you tell it to do, and that is not what you really
wanted it to do!
Seeya Larry Teghtmeyer